<?php

// We will store all URLs in arrays

$urisOfFirstJavascripts = pref('[Loop]/views/urisOfFirstJavascripts');
$urisOfLastJavascripts = pref('[Loop]/views/urisOfLastJavascripts');
$urisOfStylesheets = pref('[Loop]/views/urisOfStylesheets');


// Define the URI of the root view

$rootView = view();
$uri = null;

if (empty($rootView->extensionId) == false)
{
	$uri = '[' . $rootView->extensionId . ']/';
}


// Add the JS and CSS for the page

$urisOfLastJavascripts[] = $uri . 'view/Javascript/Page.' . $rootView->name . '.js';
$urisOfStylesheets[] = $uri . 'view/Stylesheet/Page.' . $rootView->name . '.css';


// Use every shared object to define the title and description

$viewTitles = array();
$viewDescriptions = array();

$objects = array_reverse(objects());
	
foreach ($objects as $object)
{
	$viewTitles[] = $object->getDefaultName();
	$viewDescriptions[] = $object->getDefaultDescription();
}


// Define the default title & description of the page

$viewTitles[] = $rootView->getTitle();
$viewDescriptions[] = $rootView->getDescription();

$viewTitle = implode(' - ', $viewTitles);
$viewDescription = implode(' - ', $viewDescriptions);


// Prepare variables for the view

v('::languageIsoCode', pref('[Loop]/localization/languageIsoCode'));
v('::urisOfFirstJavascripts', $urisOfFirstJavascripts);
v('::urisOfLastJavascripts', $urisOfLastJavascripts);
v('::urisOfStylesheets', $urisOfStylesheets);
v('::viewDescription', $viewDescription);
v('::viewDescriptions', $viewDescriptions);
v('::viewTitle', $viewTitle);
v('::viewTitles', $viewTitles);

?>
